package com.desk.api.controller;

import com.desk.api.emtity.Result;
import com.desk.api.emtity.TempHum;
import com.desk.api.service.TempHumService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/desk/hum")
public class TempHumController {

  @Resource private TempHumService tempHumService;

  @GetMapping("/getLastDate")
  public Result<?> getLastDate() {
    TempHum hum =
        tempHumService.lambdaQuery().orderByDesc(TempHum::getCreateTime).last("limit 1").one();
    return Result.success(hum);
  }
}
